<?php
class InputAction extends Action{
	/*******************************************************************************************************************************************

	******************************************************************************************************************************************


	添加字段表单输出


	******************************************************************************************************************************************

	*******************************************************************************************************************************************/
	public function add_input($name,$sort,$parameters) {//添加字段input表单输出$name字段名,$sort类型,$parameters参数,$field
		switch ($sort)
		{
			case "text"://1.text文本字段 免设置
			$show = "<input class=\"\" type=\"text\" name=\"$name\" id=\"$name\" />";
			break;
			case "password"://2.password密码字段
			$show = "<input class=\"\" type=\"password\" name=\"$name\" id=\"$name\" />";
			break;
			case "textarea"://3.textarea文本区域
			$show = "<textarea name=\"$name\" id=\"$name\" cols=\"45\" rows=\"5\"></textarea>";
			break;
			case "hidden"://4.hidden隐藏域
			$show = "<input type=\"hidden\" name=\"$name\" id=\"$name\" />";
			break;
			case "checkboxlist"://5.checkboxlist列表项复选框
			$parameters = $this->list_cut($parameters);
			for ($i=0;$i<count($parameters);$i++)
			{
				$checkboxlist = "<input type=\"checkbox\" name=\"$name\" id=\"$name\" value=\"".$parameters[$i][1]."\" />".$parameters[$i][0];
				for ($i=1;$i<count($parameters);$i++)
				{
					$checkboxlist = $checkboxlist." <input type=\"checkbox\" name=\"$name\" id=\"$name\" value=\"".$parameters[$i][1]."\" />".$parameters[$i][0];
				}
			}
			$show = $checkboxlist;
			break;
			case "radio"://6.radio是否单选框
			$show = "<input class=\"\" type=\"radio\" name=\"$name\" id=\"$name\" value=\"1\" />是 <input class=\"\" type=\"radio\" name=\"$name\" id=\"$name\" value=\"0\" />否";
			break;
			case "radiolist"://7.radiolist列表项单选框
			$parameters = $this->list_cut($parameters);
			for ($i=0;$i<count($parameters);$i++)
			{
				$radiolist = "<input type=\"radio\" name=\"$name\" id=\"$name\" value=\"".$parameters[$i][1]."\" />".$parameters[$i][0];
				for ($i=1;$i<count($parameters);$i++)
				{
					$radiolist = $radiolist." <input type=\"radio\" name=\"$name\" id=\"$name\" value=\"".$parameters[$i][1]."\" />".$parameters[$i][0];
				}
			}
			$show = $radiolist;
			break;
			case "select"://8.select下拉列表
				$parameters = $this->list_cut($parameters);
				for ($i=0;$i<count($parameters);$i++)
				{
					$select = "<option value=\"".$parameters[$i][1]."\">".$parameters[$i][0]."</option>\n";
					for ($i=1;$i<count($parameters);$i++)
					{
						$select = $select."<option value=\"".$parameters[$i][1]."\">".$parameters[$i][0]."</option>\n";
					}
				}
				$listStart = "<select class=\"\" name=\"$name\" id=\"$name\">\n";
				$listEnd = "</select>\n";
				$show = $listStart.$select.$listEnd;
			break;
			case "selectdouble"://9.selectdouble双重数据表下拉列表
				$parameters = $this->table_cut($parameters);
				$select = $this->judge_sort($parameters[0][0],$parameters[0][1],$name);
				$show = $select;
			break;
			case "selectthree"://10.selectthree三重数据表下拉列表
				$parameters = $this->table_cut($parameters);
				$select = $this->threeselect($parameters[0][0],$parameters[0][1],$parameters[0][2],$parameters[1][0],$parameters[1][1]);
				$show = $select;
			break;
			case "picfile"://11.picfile具备缩略图的图片上传
				$show = "<input type=\"file\" name=\"$name\" id=\"$name\" />";
			break;
			case "file"://13.file附件上传
				$show = "<input type=\"file\" name=\"$name\" id=\"$name\" />";
			break;
			case "time"://14.time日期时间
				$show = "<input class=\"\" type=\"text\" name=\"$name\" id=\"$name\" onFocus=\"CalendarWebControl.show(this,true,this.value);\" />";
			break;
			case "hiddentime"://15.hiddentime隐藏的日期时间
				$show = "自动添加当前时间";
			break;
			case "edit"://16.edit文本编辑 （文本编辑器）
			$parameters = $this->list_cut($parameters);
			switch ($parameters[0][1])
			{
				case "0"://编辑器简单功能设置
					$action = ',
toolbar : [
[ \'Source\', \'-\', \'FontSize\', \'TextColor\', \'-\', , \'Bold\', \'Italic\', \'-\', \'JustifyLeft\', \'JustifyCenter\', \'JustifyRight\', \'-\', \'NumberedList\', \'BulletedList\', \'-\', \'Link\', \'Unlink\' ]
]';
					break;
				case "5"://编辑器基本功能设置
					$action = ',
toolbar : [
[\'Format\',\'Font\',\'FontSize\',\'-\',\'TextColor\',\'BGColor\',\'-\',\'Bold\',\'Italic\',\'Underline\',
      \'Strike\',\'Subscript\',\'Superscript\',\'NumberedList\',\'BulletedList\'],
         \'/\',
        [\'Undo\',\'Redo\',\'Cut\',\'Copy\',\'Paste\',\'PasteText\',\'PasteFromWord\'],
        [\'JustifyLeft\',\'JustifyCenter\',\'JustifyRight\',\'JustifyBlock\',\'-\',
                 \'Outdent\',\'Indent\',\'Blockquote\'],
        [\'Link\',\'Unlink\',\'Anchor\',\'Image\',\'Flash\',\'Table\',
          \'HorizontalRule\',\'Smiley\',\'SpecialChar\'],
       [\'Source\',\'-\',\'Maximize\',\'-\',\'About\']
]';
					break;
				case "10"://编辑器所有功能
					$action = '';
					break;
			}
			if ($parameters[1][1] != "") {
				$width = 'width:\''.$parameters[1][1].'\'';
			}else{
				$width = '';
			}
			if ($parameters[2][1] != "") {
				$height = ',
height:\''.$parameters[2][1].'\'';
			}else{
				$height = '';
			}
			$show = '<textarea name="'.$name.'"></textarea>
<script type="text/javascript">
var editor = CKEDITOR.replace( \''.$name.'\',
{
'.$width.'
'.$height.'
'.$action.'
});
CKFinder.SetupCKEditor(editor, \''.CKFINDER_PATH.'\');
</script>';
			break;
			case "sortlevel"://17.sortlevel分类级别字段
			$tablename_cut = $this->cut_frefix($_GET['table']);
			$list = M($tablename_cut);//读取目标数据表数据列，转为数组
			$listtitle = $list->findall();
			$key = $list->getPk();
			$first = "<select id=\"$name\" name=\"$name\"><option value=\"\">请选择</option>";
			$last = "</select>";
			for ($i = 0;$i<count($listtitle);$i++)
			{
				$listgood = $listgood."<option class=\"adminput-sort1\" value=\"".$listtitle[$i][$key]."\">".$listtitle[$i][$parameters]."</option>\n";
				$listgood = $listgood.$this->Unlimited_sort($name,$listtitle[$i][$key],$tablename_cut,$key,$parameters,2,"&nbsp; &nbsp;");
			}
			$show = $first.$listgood.$last;
			break;
			case "photo"://18.photo列表显示图片字段
				$show = "<input type=\"file\" name=\"$name\" id=\"$name\" />";
			break;
			case "Album"://19.（album相册）Album相册封面图片字段
				$show = "<input type=\"file\" name=\"$name\" id=\"$name\" />";
			break;
			case "regional"://22.regional省城市地区字段
				
			break;
			default:
				$show = "<input class=\"\" type=\"text\" name=\"$name\" id=\"$name\" />";
			break;
		}
		return $show;
	}
	/*******************************************************************************************************************************************

	******************************************************************************************************************************************


	更新字段表单输出


	******************************************************************************************************************************************

	*******************************************************************************************************************************************/
	public function update_input($name,$sort,$parameters,$value) {//字段input表单输出$name字段名,$sort类型,$parameters参数,$field
		switch ($sort)
		{
			case "text"://1.text文本字段 免设置
			$show = "<input class=\"\" type=\"text\" name=\"$name\" id=\"$name\" value=\"$value\" />";
			break;
			case "password"://2.password密码字段
			$show = "<input class=\"\" type=\"password\" name=\"$name\" id=\"$name\" value=\"$value\" />";
			break;
			case "textarea"://3.textarea文本区域
			$show = "<textarea name=\"$name\" id=\"$name\" cols=\"45\" rows=\"5\">$value</textarea>";
			break;
			case "hidden"://4.hidden隐藏域
			$show = "<input type=\"hidden\" name=\"$name\" id=\"$name\" value=\"$value\" />";
			break;
			case "checkboxlist"://5.checkboxlist列表项复选框
			$parameters = $this->list_cut($parameters);
			for ($i=0;$i<count($parameters);$i++)
			{
				if ($value == $parameters[$i][1]) {
					$checked = "checked=\"checked\"";
				}else{
						$checked = "";
					}
				$checkboxlist = "<input type=\"checkbox\" name=\"$name\" id=\"$name\" value=\"".$parameters[$i][1]."\" $checked />".$parameters[$i][0];
				for ($i=1;$i<count($parameters);$i++)
				{
					if ($value == $parameters[$i][1]) {
					$checked = "checked=\"checked\"";
				}else{
						$checked = "";
					}
					$checkboxlist = $checkboxlist." <input type=\"checkbox\" name=\"$name\" id=\"$name\" value=\"".$parameters[$i][1]."\" $checked />".$parameters[$i][0];
				}
			}
			$show = $checkboxlist;
			break;
			case "radio"://6.radio是否单选框
			if ($value == "1") {
					$checked = "checked=\"checked\"";
			}else{
					$checked = "";
			}
			if ($value == "0") {
					$checked1 = "checked=\"checked\"";
			}else{
						$checked1 = "";
			}
			$show = "<input class=\"\" type=\"radio\" name=\"$name\" id=\"$name\" value=\"1\" $checked />是 <input class=\"\" type=\"radio\" name=\"$name\" id=\"$name\" value=\"0\" $checked1 />否";
			break;
			case "radiolist"://7.radiolist列表项单选框
			$parameters = $this->list_cut($parameters);
			for ($i=0;$i<count($parameters);$i++)
			{
				if ($value == $parameters[$i][1]) {
					$checked = "checked=\"checked\"";
					}else{
						$checked = "";
					}
				$radiolist = "<input type=\"radio\" name=\"$name\" id=\"$name\" value=\"".$parameters[$i][1]."\" $checked />".$parameters[$i][0];
				for ($i=1;$i<count($parameters);$i++)
				{
					if ($value == $parameters[$i][1]) {
					$checked = "checked=\"checked\"";
					}else{
						$checked = "";
					}
					$radiolist = $radiolist." <input type=\"radio\" name=\"$name\" id=\"$name\" value=\"".$parameters[$i][1]."\" $checked />".$parameters[$i][0];
				}
			}
			$show = $radiolist;
			break;
			case "select"://8.select下拉列表
			$parameters = $this->list_cut($parameters);
			for ($i=0;$i<count($parameters);$i++)
			{
				if ($value == $selectdouble[$i][$id]) {
						$selected = "selected=\"selected\"";
					}else{
						$selected = "";
					}
				$select = "<option value=\"".$parameters[$i][1]."\" $selected>".$parameters[$i][0]."</option>\n";
				for ($i=1;$i<count($parameters);$i++)
				{
					if ($value == $selectdouble[$i][$id]) {
						$selected = "selected=\"selected\"";
					}else{
						$selected = "";
					}
					$select = $select."<option value=\"".$parameters[$i][1]."\" $selected>".$parameters[$i][0]."</option>\n";
				}
			}
			$listStart = "<select class=\"\" name=\"$name\" id=\"$name\">\n";
			$listEnd = "</select>\n";
			$show = $listStart.$select.$listEnd;
			break;
			case "selectdouble"://9.selectdouble双重数据表下拉列表
				$parameters = $this->table_cut($parameters);
				$select = $this->judge_sort_update($parameters[0][0],$parameters[0][1],$value,$name);
				$show = $select;
			break;
			case "selectthree"://10.selectthree三重数据表下拉列表
				$parameters = $this->table_cut($parameters);
				$select = $this->threeselect($parameters[0][0],$parameters[0][1],$parameters[0][2],$parameters[1][0],$parameters[1][1]);
				$show = $select;
			break;
			case "picfile"://11.picfile具备缩略图的图片上传
				if ($value != "") {
					$value = explode(";", $value);//截取参数项
				if (!strpos($value,"http://")) {
					$value[0] = "/".$value[0];
					$value[1] = "/".$value[1];
				}
				$img = "<a target=\"_blank\" href=\"".$value[1]."\"><img class=\"spic\" border=\"0\" src=\"".$value[0]."\" /></a><br />"."<input type=\"hidden\" name=\"del1_$name\" id=\"del1_$name\" value=\"$value[0]\" />"."<input type=\"hidden\" name=\"del2_$name\" id=\"del2_$name\" value=\"$value[1]\" />";
				}
				
				
				$show = $img."<input type=\"file\" name=\"$name\" id=\"$name\" />";
			break;
			case "file"://13.file附件上传
				$show = "<input type=\"file\" name=\"$name\" id=\"$name\" />";
			break;
			case "time"://14.time日期时间
				$value = date("Y-m-d H:i",$value);
				$show = "<input class=\"\" type=\"text\" name=\"$name\" id=\"$name\" value=\"$value\" onFocus=\"CalendarWebControl.show(this,true,this.value);\" />";
			break;
			case "hiddentime"://15.hiddentime隐藏的日期时间
				$show = date("Y-m-d H:i",time());
			break;
			case "edit"://16.edit文本编辑 （文本编辑器）
				$parameters = $this->list_cut($parameters);
				switch ($parameters[0][1])
				{
					case "0"://编辑器简单功能设置
						$action = ',
	toolbar : [
	[ \'Source\', \'-\', \'FontSize\', \'TextColor\', \'-\', , \'Bold\', \'Italic\', \'-\', \'JustifyLeft\', \'JustifyCenter\', \'JustifyRight\', \'-\', \'NumberedList\', \'BulletedList\', \'-\', \'Link\', \'Unlink\' ]
	]';
						break;
					case "5"://编辑器基本功能设置
						$action = ',
	toolbar : [
	[\'Format\',\'Font\',\'FontSize\',\'-\',\'TextColor\',\'BGColor\',\'-\',\'Bold\',\'Italic\',\'Underline\',
	      \'Strike\',\'Subscript\',\'Superscript\',\'NumberedList\',\'BulletedList\'],
	         \'/\',
	        [\'Undo\',\'Redo\',\'Cut\',\'Copy\',\'Paste\',\'PasteText\',\'PasteFromWord\'],
	        [\'JustifyLeft\',\'JustifyCenter\',\'JustifyRight\',\'JustifyBlock\',\'-\',
	                 \'Outdent\',\'Indent\',\'Blockquote\'],
	        [\'Link\',\'Unlink\',\'Anchor\',\'Image\',\'Flash\',\'Table\',
	          \'HorizontalRule\',\'Smiley\',\'SpecialChar\'],
	       [\'Source\',\'-\',\'Maximize\',\'-\',\'About\']
	]';
						break;
					case "10"://编辑器所有功能
						$action = '';
						break;
				}
				if ($parameters[1][1] != "") {
					$width = 'width:\''.$parameters[1][1].'\'';
				}else{
					$width = '';
				}
				if ($parameters[2][1] != "") {
					$height = ',
	height:\''.$parameters[2][1].'\'';
				}else{
					$height = '';
				}
				$show = '<textarea name="'.$name.'">'.$value.'</textarea>
	<script type="text/javascript">
	var editor = CKEDITOR.replace( \''.$name.'\',
	{
	'.$width.'
	'.$height.'
	'.$action.'
	});
	CKFinder.SetupCKEditor(editor, \''.CKFINDER_PATH.'\');
	</script>';
			break;
			case "sortlevel"://17.sortlevel分类级别字段
				$tablename_cut = $this->cut_frefix($_GET['table']);
				$list = M($tablename_cut);//读取目标数据表数据列，转为数组
				$listtitle = $list->findall();
				$key = $list->getPk();
				$first = "<select id=\"$name\" name=\"$name\"><option value=\"\">请选择</option>";
				$last = "</select>";
				for ($i = 0;$i<count($listtitle);$i++)
				{
					if ($value == $listtitle[$i][$key]) {
							$selected = "selected=\"selected\"";
						}else{
							$selected = "";
						}
					$listgood = $listgood."<option class=\"adminput-sort1\" value=\"".$listtitle[$i][$key]."\" $selected>".$listtitle[$i][$parameters]."</option>\n";
					$listgood = $listgood.$this->Unlimited_sort_update($name,$listtitle[$i][$key],$tablename_cut,$key,$parameters,2,"&nbsp; &nbsp;",$value);
				}
				$show = $first.$listgood.$last;
			break;
			
			default:
				$show = "<input class=\"\" type=\"text\" name=\"$name\" id=\"$name\" />";
			break;
		}
		return $show;
	}
	/*******************************************************************************************************************************************

	******************************************************************************************************************************************


	参数类操作


	******************************************************************************************************************************************

	*******************************************************************************************************************************************/
	public function list_cut($field){//列表式切取参数项
		$field = explode(";", $field);//截取参数项
		for ($i = 0;$i < count($field) - 1;$i++) {
			$showoption[$i] = $this->cut_array($field[$i]);
		}
		return $showoption;
	}
	public function table_cut($field){//数据表切取参数项
		$field = explode(";", $field);//截取参数项
		for ($i = 0;$i < count($field) - 1;$i++) {
			$showoption[$i] = explode(":",$field[$i]);
		}
		return $showoption;
	}
	public function cut_array($option){//分割参数与显示
		$show = explode("=",$option);
		return $show;
	}
	public function cut_frefix($tablename){//分割参数与显示
		$show = explode("_",$tablename);
		return $show[1];
	}
	public function judge_sort($tablename,$field,$name){//二级分类列表规则
		$sort = M('admin_table');
		$date = $sort->where('admin_table_name = "'.$tablename.'"')->getField('admin_table_sort');
		$tablename_cut = $this->cut_frefix($tablename);

		$list = M($tablename_cut);//读取目标数据表数据列，转为数组
		$id = $list->getPk();//获取数据表主键名称
		if ($date == "3") {//当读取的二重下拉数据表为分类列表，3为分类式数据表
			$sortlevel = M('admin_field');//读取字段管理数据表
			$sortle = $sortlevel->where('admin_field_tableid = \''.$tablename.'\' and admin_field_sort = \'sortlevel\'')->getField('admin_field_name');//读取分类表分类级别字段
			$selectdouble = $list->where($sortle.' = \'0\' or '.$sortle.' = \'\'')->select();//读取分类级别字段数据为0或为空时的第一级分类
			for ($i=0;$i<count($selectdouble);$i++)
			{
				$select = $select."<option class=\"adminput-sort1\" value=\"".$selectdouble[$i][$id]."\">".$selectdouble[$i][$field]."</option>\n";//adminput-sort1为class
				$select = $select.$this->Unlimited_sort($sortle,$selectdouble[$i][$id],$tablename_cut,$id,$field,2,"&nbsp; &nbsp;");
			}
			$listStart = "<select class=\"adminput selectdouble\" name=\"$name\" id=\"$name\">\n";
			$listEnd = "</select>\n";
		}else{
			$selectdouble = $list->select();
			for ($i=0;$i<count($selectdouble);$i++)
			{
				$select = "<option value=\"".$selectdouble[$i][$id]."\">".$selectdouble[$i][$field]."</option>\n";
				for ($i=1;$i<count($selectdouble);$i++)
				{
					$select = $select."<option value=\"".$selectdouble[$i][$id]."\">".$selectdouble[$i][$field]."</option>\n";
				}
			}
			$listStart = "<select class=\"adminput selectdouble\" name=\"$name\" id=\"$name\">\n";
			$listEnd = "</select>\n";
		}
		$show = $listStart.$select.$listEnd;
		return $show;
	}
	public function Unlimited_sort($sortle,$sortlevel,$tablename_cut,$id,$field,$ttl,$bnsp){//无限分类列表循环$sortle 字段名 $sortlevel 上级ID $tablename_cut 数据表 $id 主键 $field 显示字段名
		$list = M($tablename_cut);//读取目标数据表数据列，转为数组
		$selectdouble = $list->where($sortle.' = \''.$sortlevel.'\'')->select();//读取分类级别字段数据
		if (count($selectdouble) > 0) {
			for ($i=0;$i<count($selectdouble);$i++){
				$select = $select."<option class=\"adminput-sort$ttl\" value=\"".$selectdouble[$i][$id]."\">$bnsp|-".$selectdouble[$i][$field]."</option>\n";//adminput-sort2为class
				$select = $select.$this->Unlimited_sort($sortle,$selectdouble[$i][$id],$tablename_cut,$id,$field,$ttl+1,$bnsp."&nbsp; &nbsp;");
			}
			return $select;
		}

	}
	public function judge_sort_update($tablename,$field,$value,$name){//二级分类列表规则
		$sort = M('admin_table');
		$date = $sort->where('admin_table_name = "'.$tablename.'"')->getField('admin_table_sort');
		$tablename_cut = $this->cut_frefix($tablename);

		$list = M($tablename_cut);//读取目标数据表数据列，转为数组
		$id = $list->getPk();//获取数据表主键名称
		if ($date == "3") {//当读取的二重下拉数据表为分类列表，3为分类式数据表
			$sortlevel = M('admin_field');//读取字段管理数据表
			$sortle = $sortlevel->where('admin_field_tableid = \''.$tablename.'\' and admin_field_sort = \'sortlevel\'')->getField('admin_field_name');//读取分类表分类级别字段
			$selectdouble = $list->where($sortle.' = \'0\' or '.$sortle.' = \'\'')->select();//读取分类级别字段数据为0或为空时的第一级分类
			for ($i=0;$i<count($selectdouble);$i++)
			{
				if ($value == $selectdouble[$i][$id]) {
					$selected = "selected=\"selected\"";
					}else{
					$selected = "";
				}
				$select = $select."<option class=\"adminput-sort1\" value=\"".$selectdouble[$i][$id]."\" $selected>".$selectdouble[$i][$field]."</option>\n";//adminput-sort1为class
				$select = $select.$this->Unlimited_sort_update($sortle,$selectdouble[$i][$id],$tablename_cut,$id,$field,2,"&nbsp; &nbsp;",$value);
			}
			$listStart = "<select class=\"adminput selectdouble\" name=\"$name\" id=\"$name\">\n";
			$listEnd = "</select>\n";
		}else{
			$selectdouble = $list->select();
			for ($i=0;$i<count($selectdouble);$i++)
			{
				if ($value == $selectdouble[$i][$id]) {
					$selected = "selected=\"selected\"";
				}else{
					$selected = "";
				}
				$select = "<option value=\"".$selectdouble[$i][$id]."\" $selected>".$selectdouble[$i][$field]."</option>\n";
				for ($i=1;$i<count($selectdouble);$i++)
				{
					if ($value == $selectdouble[$i][$id]) {
						$selected = "selected=\"selected\"";
					}else{
						$selected = "";
					}
					$select = $select."<option value=\"".$selectdouble[$i][$id]."\" $selected>".$selectdouble[$i][$field]."</option>\n";
				}
			}
			$listStart = "<select class=\"adminput selectdouble\" name=\"$name\" id=\"$name\">\n";
			$listEnd = "</select>\n";
		}
		$show = $listStart.$select.$listEnd;
		return $show;
	}
	public function Unlimited_sort_update($sortle,$sortlevel,$tablename_cut,$id,$field,$ttl,$bnsp,$value){//无限分类列表循环$sortle 字段名 $sortlevel 上级ID $tablename_cut 数据表 $id 主键 $field 显示字段名
		$list = M($tablename_cut);//读取目标数据表数据列，转为数组
		$selectdouble = $list->where($sortle.' = \''.$sortlevel.'\'')->select();//读取分类级别字段数据
		if (count($selectdouble) > 0) {
			for ($i=0;$i<count($selectdouble);$i++){
				if ($value == $selectdouble[$i][$id]) {
						$selected = "selected=\"selected\"";
					}else{
						$selected = "";
					}
				$select = $select."<option class=\"adminput-sort$ttl\" value=\"".$selectdouble[$i][$id]."\" $selected>$bnsp|-".$selectdouble[$i][$field]."</option>\n";//adminput-sort2为class
				$select = $select.$this->Unlimited_sort_update($sortle,$selectdouble[$i][$id],$tablename_cut,$id,$field,$ttl+1,$bnsp."&nbsp; &nbsp;");
			}
			return $select;
		}

	}
	public function threeselect($table1,$field1,$field2,$table2,$field)
	{
		$ddt = M($table);//实例化第一张表
		$sortle = $ddt->where($field1." = ''")->getField($field2);
	}
}
?>
